import { BrowserRouter, Routes, Route, Navigate } from "react-router";
import LoginPage from "@/pages/login";
import HomePage from "@/pages/home";
import Layout from "@/layout";

const AppRoutes = () => {
  return (
    <>
      <BrowserRouter>
        <Routes>
          {/* 默认路由 */}
          <Route index path="/" element={<Navigate to="/login" replace />} />

          {/* 登录页 */}
          <Route path="/login" element={<LoginPage />} />

          {/* 模板页 */}
          <Route path="layout" element={<Layout />}>
            {/* 主页面 */}
            <Route index path="home" element={<HomePage />} />
          </Route>
        </Routes>
      </BrowserRouter>
    </>
  );
};

// 路由表
export default AppRoutes;
